package com.example.controller;

import com.example.entity.detection.DetectionElevator;
import com.example.entity.detection.ExtDetectionElevator;
import com.example.service.DetectionElevatorService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 所有检测作业，关联电梯的操作
 */
@RestController
@RequestMapping(value = "api/detectionElevator/")
public class DetectionElevatorController {

    @Autowired
    private DetectionElevatorService detectionElevatorService;

    @ApiOperation(value = "添加检测关联的电梯",notes = "添加检测关联的电梯")
    @RequestMapping(value="add",method = RequestMethod.POST)
    Map<String,Object> addDetectionElevator(@RequestBody List<DetectionElevator> detectionElevators){
        return detectionElevatorService.add(detectionElevators);
    }

    @ApiOperation(value = "更新检测关联的电梯",notes = "更新检测关联的电梯")
    @RequestMapping(value="update",method = RequestMethod.POST)
    Map<String,Object> updateDetectionElevator(@RequestBody Map map){
        return detectionElevatorService.update(map);
    }

    @ApiOperation(value = "查询检测关联的电梯",notes = "查询检测关联的电梯")
    @RequestMapping(value="query",method = RequestMethod.POST)
    Map<String,Object> queryDetectionElevator(@RequestBody ExtDetectionElevator detectionElevator){
        return detectionElevatorService.query(detectionElevator);
    }

    @ApiOperation(value = "统计不同检查状态的电梯数量",notes = "统计不同检查状态的电梯数量")
    @RequestMapping(value="countElevator",method = RequestMethod.POST)
    Map<String,Object> getElevatorCount(@RequestBody Map map){
        return detectionElevatorService.countElevator(map);
    }


}
